package comc.util;

import com.wf.captcha.ArithmeticCaptcha;
import com.wf.captcha.ChineseCaptcha;
import com.wf.captcha.base.Captcha;
import com.wf.captcha.base.Randoms;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class Yzm {
    public Map getYam() throws FileNotFoundException {
//        中文
//        Captcha captcha=new ChineseCaptcha();
//        算数
//        Captcha captcha=new ArithmeticCaptcha();
        Captcha captcha = new ArithmeticCaptcha();

        String text = captcha.text();
        System.out.println(text);
        String patchtext = "C:\\Users\\SINO\\Desktop\\tt\\" + UUID.randomUUID() + "yzm.png";
        boolean out = captcha.out(new FileOutputStream(new File(patchtext)));
        Map map = new HashMap();
        map.put("yzmpatch", patchtext);
        map.put("resulr", text);
        System.out.println(map.toString());
        return map;
    }

    public static void main(String[] args) throws FileNotFoundException {
        Yzm yzm = new Yzm();
        yzm.getYam();
        IdWorker idWorker=new IdWorker();
        System.out.println(idWorker.nextId());
    }
}
